<?php

require_once 'Base.php';

class Custom_Helper_FetchResult extends Dummy_Helper_Base  {

	public function showProfiles($search, $page)	{		
		$this->view->results = $search->results;
		$this->view->count = $search->count;
		$this->view->currentPage = $search->currentPage;
		$num_pages = $search->numPages;
		$req = $this->getActionController()->getRequest();

		$pageLinks = array();

		if ($page > $num_pages)
			$page = $num_pages;
		if ($page <= 0)
			$page = 1;
		for($x = 1; $x <= $num_pages; $x ++) {
			if ($x == $page) {
				$pageLinks [] = $x;
			} else {
				$req->setParam('search_page', $x);
				$pageLinks [] = $this->view->url ( $req->getParams(), null, false );
			}
		}
		$this->view->pageLinks = $pageLinks;
	}
	
    public function direct($search, $page)
    {
        return $this->showProfiles($search, $page);
    }
}

?>